<script type="text/javascript">
	
function RandomListNode(x){
    this.val = x;
    this.next = null;
}
let a = new RandomListNode(1)
let b = new RandomListNode(2)
let c = new RandomListNode(3)
let d = new RandomListNode(4)
let e = new RandomListNode(11)
let f = new RandomListNode(12)
a.next = b;
b.next = c;
c.next = d;
d.next = null;
e.next = f;
f.next = d;

function FindFirstCommonNode(pHead1, pHead2)
{
    let p1 = pHead1, p2 = pHead2;
    while(p1.next!=null && p2.next!=null) {
        p1 = p1.next;
        p2 = p2.next;
    }
    if(p1.next!==null) {
        return p1;
    } else {
        return p2;
    }
}
const res = FindFirstCommonNode(a,e)
console.log(res)

</script>